<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form method="POST" action="" enctype="multipart/form-data">
        <input type="file" name="img">
        <input type="submit" value="提交">
    </form>
    <button data-index="0" data-a="你好" data-id="100">按钮</button>
    <script>
        // 自定义数据
        var btn = document.querySelector('button');
        console.log(btn.dataset)
    </script>
</body>
</html>